package com.exercise.widgets.viewpager2

import android.os.Bundle
import android.view.LayoutInflater
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.exercise.struct.base.BaseActivity
import com.exercise.struct.viewmodel.BaseViewModel
import com.exercise.widgets.R
import com.exercise.widgets.databinding.ActivityCardViewTabLayoutBinding
import com.exercise.widgets.viewpager2.cards.Card
import com.exercise.widgets.viewpager2.cards.CardViewAdapter
import com.google.android.material.tabs.TabLayoutMediator

class CardViewTabLayoutActivity : BaseActivity<BaseViewModel,ActivityCardViewTabLayoutBinding>() {
    override val bindingInflater: (LayoutInflater) -> ActivityCardViewTabLayoutBinding
        get() = ActivityCardViewTabLayoutBinding::inflate
    override val modelClass: Class<BaseViewModel>
        get() = BaseViewModel::class.java

    override fun initData() {
    }

    override fun initView() {
        binding.viewPager.adapter = CardViewAdapter()
        TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position ->
            tab.text = Card.DECK[position].toString()
        }.attach()
    }

}